<div class="row">

    <div class="col-md-12">      		
    	
    	<div class="widget stacked ">
    

            <div class="widget-content">

                
                <br />
                
                <section id="tables">
                    <div class="page-header">
                        <h3><?php echo $title; ?></h3>
                    </div>
                    
                    <div class="table-responsive">
                        <div class="col-md-4">
                            <form class="form-horizontal" role="form" method="post" action="<?php echo site_url('Patient/Consultation/start'); ?>">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label" for="id_type"><?php echo $this->l('Type'); ?></label>
                                    <div class="col-sm-10">
                                        <select  class="form-control" id="id_type" name="id_type">
                                            <?php foreach ($consultations_types as $consultations_type): ?>
                                                <option value="<?php echo $consultations_type->id_type; ?>">
                                                    <?php echo $consultations_type->label; ?>
                                                </option>
                                            <?php endforeach; ?>                                        
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label" for="id_doctor"><?php echo $this->l('Doctor'); ?></label>
                                    <div class="col-sm-10">
                                        <select  class="form-control" id="id_doctor" name="id_doctor">
                                           <?php foreach ($doctors as $doctor): ?>
                                                <option value="<?php echo $doctor->id_doctor; ?>">
                                                    <?php echo $doctor->lastname; ?>
                                                </option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>
                                  </div>
                                  <div class="form-group">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-10">
                                        <button type="submit" value="1" name="btn_submit" class="btn btn-success"><?php echo $this->l('Go to payment'); ?> <i class="icon icon-share-alt"></i></button>
                                    </div>
                                </div>
                                  
                            </form>
                        </div>
                        <div class="col-md-8">
                            <table class="table table-striped table-bordered">
                                <thead>
                                  <tr>
                                    <th>#</th>
                                    <th><?php echo $this->l('Status'); ?></th>
                                    <th><?php echo $this->l('Type'); ?></th>
                                    <th><?php echo $this->l('Doctor'); ?></th>
                                    <th><?php echo $this->l('Date'); ?></th>
                                    <th><?php echo $this->l('Actions'); ?></th>
                                  </tr>
                                </thead>
                                <tbody>
                                    <?php foreach ($consultations as $key => $value) { ?>
                                        <tr>
                                            <td><?php echo $value->id_consultation; ?></td>
                                            <td><?php echo $value->cons_status_label; ?></td>
                                            <td><?php echo $value->cons_type_label; ?></td>
                                            <td><?php echo $value->doctor_name; ?></td>
                                            <td>
                                                <?php $date = date_create_from_format('Y-m-d H:i:s', $value->date_add);
                                                echo date_format($date, 'd F Y').' at ';
                                                echo date_format($date, 'H:i A'); ?>
                                            </td>
                                            <td>
                                                <a class="btn btn-xs btn-success <?php if ( !in_array($value->last_id_history, array('3','4','5')) OR $value->doctor_is_connected == 0) { ?>disabled<?php }  ?>" href="<?php echo site_url('Patient/Consultation/Start/'.$value->id_consultation); ?>">
                                                    <i class="icon icon-edit"></i>
                                                    <?php echo $this->l('Start consultation'); ?>
                                                </a>
                                                
                                                <a class="btn btn-xs btn-primary" href="<?php echo site_url('Doctor/Prescription/send/?prescription='.$value->id_consultation.'&patient='.$value->id_patient); ?>"><i class="icon icon-envelope"></i></a>
                                                <a class="btn btn-xs btn-danger" href="<?php echo site_url('Doctor/Prescription/stop/'.$value->id_consultation); ?>"><i class="icon icon-remove-sign"></i></a>
                                            </td>
                                        </tr>
                                    <?php }  ?>                                                    
                                </tbody>
                            </table>
                        </div>
                        
                    </div> <!-- /.table-responsive -->

                    <?php //include(dirname(__FILE__).'/../layout/pagination.php'); ?>
                    
                </section>
    			
    		</div> <!-- /widget-content -->
    			
    	</div> <!-- /widget -->
    	
    </div> <!-- /span12 -->

</div> <!-- /row -->